<?
$smarty=new Smarty();
if(!ANTIHACK) die("ANTIHACK...");
include_once("../includes/language_vi.php");
$smarty->assign("nameact","Thông tin tài khoản");
if(!isset($_SESSION['id']) || intval($_SESSION['id'])<1)
	header("location:".base_admin);
else
{
	$id=intval($_SESSION['id']);
}
if(isset($_POST['saveuser']))
{
	$pass = addslashes($_POST['edit-password']);
	$data=array();
	if($_POST['avatar']!="")$data["avatar"] =$_POST['avatar'];

	if($pass!="")
		$data["password"] = md5($pass);
	if(update($data,"user","id=$id"))
		$smarty->assign("msg","Đổi mật khẩu thành công!"."<script>setTimeout('location.href=\"".base_admin."\"',1000);</script>");
	else
		$smarty->assign("msg",$msg['error']);
}
	$query=query("select * from user where id=$id");
	$num = numrows($query);
	if($num!=1)
		$smarty->assign("msg",$msg["account_not_found"]);
	else
	{
		$r=fetch($query);
		$smarty->assign("data",$r);
	}
$smarty->display("edit-profile.htm");

?>